#include "serverconfig.h"

ServerConfig::ServerConfig():serverip(""),publicip(""),port(4567),threadcount(1)
{

}


ServerConfig::~ServerConfig()
{

}

void ServerConfig::parsexml(const char* xmlpath)
{

	XMLDocument docXml;
	docXml.LoadFile(xmlpath);
	XMLElement* elmtRoot = docXml.RootElement();
	XMLElement *elmServerIp = elmtRoot->FirstChildElement("serverip");
	XMLElement *elmtPublicIp = elmtRoot->FirstChildElement("publicip");
	XMLElement *elmtPort = elmtRoot->FirstChildElement("port");
	XMLElement *elmtthread = elmtRoot->FirstChildElement("thread");
	this->serverip = elmServerIp->GetText();
	this->publicip = elmtPublicIp->GetText();
	this->port = atoi(elmtPort->GetText());
	this->threadcount = atoi(elmtthread->GetText());
	cout << "serverip:" << this->serverip << " port:" << this->port << endl;
	cout << "threadcount:" << this->threadcount << endl;

}
